//
//  CircleInfoTableViewCell.m
//  Lucky28
//
//  Created by zr on 2018/8/3.
//  Copyright © 2018年 zr. All rights reserved.
//

#import "CircleInfoTableViewCell.h"

@interface CircleInfoTableViewCell ()


@property (nonatomic, weak)UIButton * sayButton;
@property (nonatomic, weak)UIView * lineView;

@end

@implementation CircleInfoTableViewCell


//- (void)setModel:(CircleInfoModel *)model{
//    
//    _model = model;
//    
//   
//}


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    if ([super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        [self setupUI];
    }
    
    return self;
}



- (void)setupUI{
    
    self.selectionStyle = UITableViewCellSelectionStyleNone;
    self.backgroundColor = [UIColor whiteColor];
    
    
    UIImageView * iconImageView = [UIImageView new];
    
    //  把图片设置成圆形
    iconImageView.layer.cornerRadius = 15;//裁成圆角
    iconImageView.layer.masksToBounds = YES;//隐藏裁剪掉的部分
    
//    iconImageView.image = ImageNamed(@"头像7");
    
    self.iconImageView = iconImageView;
    
    [self.contentView addSubview:self.iconImageView];
    
    
    UILabel * nameLabel = [UILabel new];
    
    nameLabel.text = @"用户姓名";
    nameLabel.textColor = ColorWithRGB(0xB5B5B5);
    nameLabel.font = [UIFont systemFontOfSize:13 * SCREENH6];
    
    self.nameLabel = nameLabel;
    
    [self.contentView addSubview:self.nameLabel];
    
    
    UILabel * timeLabel = [UILabel new];
    
    timeLabel.text = @"15分钟前";
    timeLabel.textColor = ColorWithRGB(0xB5B5B5);
    timeLabel.font = [UIFont systemFontOfSize:12 * SCREENH6];
    timeLabel.textAlignment = NSTextAlignmentRight;
    
    self.timeLabel = timeLabel;
    
    [self.contentView addSubview:self.timeLabel];
    
    
    UILabel * explationLabel = [UILabel new];
    
    explationLabel.text = @"用户姓名ooterView has been deprecated. Please set a custom UIView with your desired background color to the backgroundView property instead.";
    explationLabel.textColor = [UIColor blackColor];
    explationLabel.font = [UIFont systemFontOfSize:14 * SCREENH6];
    explationLabel.numberOfLines = 0;
    
    self.explationLabel = explationLabel;
    
    [self.contentView addSubview:self.explationLabel];
    
    
    UIButton * sayButton = [UIButton new];
    
    [sayButton setImage:ImageNamed(@"pinglun") forState:UIControlStateNormal];
    [sayButton addTarget:self action:@selector(clickSayButton) forControlEvents:UIControlEventTouchUpInside];
    
    self.sayButton = sayButton;
    
    [self.contentView addSubview:self.sayButton];
    
    
    UIView * lineView = [UIView new];
    
    lineView.backgroundColor = ColorWithRGB(0xa9a9a9);
    
    self.lineView = lineView;
    
    [self.contentView addSubview:self.lineView];
    
    
    
    [self.iconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.height.width.mas_equalTo(30 * SCREENH6);
        make.leading.mas_equalTo(self.contentView).offset(15 * SCREENH6);
        make.top.mas_equalTo(self.contentView).offset(15 * SCREENH6);
    }];
    
    [self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.mas_equalTo(self.iconImageView.mas_trailing).offset(15 * SCREENH6);
        make.top.mas_equalTo(self.contentView).offset(15 * SCREENH6);
    }];
    
    [self.timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.nameLabel);
        make.trailing.mas_equalTo(self.contentView).offset(-15 * SCREENH6);
    }];
    
    [self.lineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.trailing.bottom.mas_equalTo(self.contentView);
        make.height.mas_equalTo(0.5 * SCREENH6);
    }];
    
    [self.explationLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.mas_equalTo(self.nameLabel);
        make.trailing.mas_equalTo(self.timeLabel);
        make.top.mas_equalTo(self.nameLabel.mas_bottom).offset(7 * SCREENH6);
        make.bottom.mas_equalTo(self.lineView.mas_top).offset(-5 * SCREENH6);
    }];
    
    [self.sayButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.trailing.mas_equalTo(self.timeLabel);
        make.bottom.mas_equalTo(self.explationLabel);
    }];
    
    
}


- (void)layoutSubviews{
    
   
}

- (void)clickSayButton{
    
    
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
